package com.hzeport.bgs22emduty.inbound.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.emergencyCall.ScreenDutyEmergencyCallDTO;
import com.hzeport.bgs22emduty.dto.emergencyCall.ScreenDutyEmergencyCallRemoveDTO;
import com.hzeport.bgs22emduty.dto.emergencyCall.ScreenDutyEmergencyCallSaveDTO;
import com.hzeport.bgs22emduty.entity.ScreenDutyEmergencyCall;
import com.hzeport.bgs22emduty.service.ScreenDutyEmergencyCallService;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * ${comments}
 *
 * @author code generator
 * @date 2023-02-14 09:39:44
 */
@RestController
@AllArgsConstructor
@RequestMapping("/screendutyemergencycall")
@Api(value = "screendutyemergencycall", tags = "值班应急联络管理")
@Slf4j
public class ScreenDutyEmergencyCallController {

    private final ScreenDutyEmergencyCallService screenDutyEmergencyCallService;

    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping("/page")
    public BaseResult getScreenDutyEmergencyCallPage(@RequestBody ScreenDutyEmergencyCallDTO screenDutyEmergencyCall) {
        Page<ScreenDutyEmergencyCall>  dutyMessageList=screenDutyEmergencyCallService.getScreenDutyEmergencyCallPage(screenDutyEmergencyCall);
        return BaseResult.ok(dutyMessageList);
    }


    /**
     **
     * 通过id查询${comments}
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("getById")
    public BaseResult getById(@RequestParam("id") String id) {
        return BaseResult.ok(screenDutyEmergencyCallService.detail(id));
    }

    /**
     * 新增${comments}
     * @param screenDutyEmergencyCall ${comments}
     * @return R
     */
    @ApiOperation(value = "新增${comments}", notes = "新增${comments}")
    //@SysLog(.*)
    @PostMapping("save")
    @OperLog(systemName = "YJLL",description = "YJXZ")
    public BaseResult save(@Valid@RequestBody ScreenDutyEmergencyCallSaveDTO screenDutyEmergencyCallSaveDTO) throws Exception {
        return BaseResult.ok(screenDutyEmergencyCallService.saveEmergencyCalls(screenDutyEmergencyCallSaveDTO));
    }
//
//    /**
//     * 修改${comments}
//     * @param screenDutyEmergencyCall ${comments}
//     * @return R
//     */
//    @ApiOperation(value = "修改${comments}", notes = "修改${comments}")
//    //@SysLog(.*)
//    @PostMapping("updateById")
//    public BaseResult updateById(@RequestBody ScreenDutyEmergencyCall screenDutyEmergencyCall) {
//        return BaseResult.ok(screenDutyEmergencyCallService.updateById(screenDutyEmergencyCall));
//    }

    /**
     * 通过id删除${comments}
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除${comments}", notes = "通过id删除${comments}")
    //@SysLog(.*)
    @PostMapping("/delete")
    @OperLog(systemName = "YJLL",description = "YJSC")
    public BaseResult remove(@Valid @RequestBody ScreenDutyEmergencyCallRemoveDTO screenDutyEmergencyCallRemoveDTO) {
        return BaseResult.ok(screenDutyEmergencyCallService.remove(screenDutyEmergencyCallRemoveDTO));
    }

}
